// An nsINavBookmarkObserver
var myExt_bookmarkListener = {
	onBeginUpdateBatch: function() {},
	onEndUpdateBatch: function() {},
	onItemAdded: function(aItemId, aFolder, aIndex) {
		var thisURI = bmsvc.getBookmarkURI(aItemId);
		var thisTitle = bmsvc.getItemTitle(aItemId);
		alert("You have bookmarked: "+thisURI.spec+"\nwith the title: "+thisTitle);	
	},
	onItemRemoved: function(aItemId, aFolder, aIndex) {a},
	onItemChanged: function(aBookmarkId, aProperty, aIsAnnotationProperty, aValue) {},
	onItemVisited: function(aBookmarkId, aVisitID, time) {},
	onItemMoved: function(aItemId, aOldParent, aOldIndex, aNewParent, aNewIndex) {},
	QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsINavBookmarkObserver])
};

var bmsvc = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Components.interfaces.nsINavBookmarksService);
bmsvc.addObserver(myExt_bookmarkListener, false);